<%--
  Created by IntelliJ IDEA.
  User: 17728
  Date: 2020/10/12
  Time: 14:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%@ include file="/pages/common/head.jsp" %>
    <script type="text/javascript">
        // 页面加载完成之后
        $(function () {
            // 给注册绑定单击事件
            $("#sub_btn").click(function () {

                var passwordText = $("#pwd1").val();

                var passwordPatt = /^\w{5,12}$/;

                if (!passwordPatt.test(passwordText)) {
                    //4 提示用户结果
                    $("span.errorMsg").text("密码不合法！");
                    return false;
                }
// 验证确认密码：和密码相同
//1 获取确认密码内容
                var repwdText = $("#pwd2").val();
//2 和密码相比较
                if (repwdText !== passwordText) {
                    //3 提示用户
                    $("span.errorMsg").text("确认密码和密码不一致！");
                    return false;
                }


            });
        });
    </script>
    <style type="text/css">
        h3 {
            position: relative;
            top: 30px;
        }

        .a {
            position: relative;
            top: 20px;
            left: 8vw;
            margin: 0 auto;
            width: 60vw;
            height: 550px;
        }

        .b {
            width: 500px;
            position: relative;
            left: 110px;
        }

        .c {
            text-align: center;
        }
    </style>
</head>
<body>
<h3 align="center">修改个人密码</h3>
<div class="a">

    <div class="b">
        <form action="UserServlet?action=updateAdmin" method="post">
            <span class="errorMsg"></span><br>
            <div class="form-group">
                <label for="uname">用户名</label>
                <input type="text" class="form-control" id="uname" disabled="disabled"
                       value="${sessionScope.user.uname}">
            </div>
            <div class="form-group">
                <label for="pwd1">密码</label>
                <input type="password" class="form-control" id="pwd1" name="password" placeholder="请输入密码">
            </div>
            <div class="form-group">
                <label for="pwd2">确认密码</label>
                <input type="password" class="form-control" id="pwd2" placeholder="请确认密码">
            </div>
            <div class="c">
                <button class="btn btn-default" type="submit" id="sub_btn" value="提交">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>
            </div>
        </form>
    </div>
</div>
</body>
</html>
